<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>员工列表</title>
    <link rel="stylesheet" th:href="@{/static/css/index.css}">
    <!--引入jquery-->
    <!--引入bootstrap-->
</head>
<body>
<table id="dataTable">
    <tr>
        <th colspan="6">员工列表</th>
    </tr>
    <tr>
        <th>序号</th>
        <th>员工信息</th>
        <th>年龄</th>
        <th>性别</th>
        <th>邮箱</th>
        <th>操作(<a th:href="@{/toAdd}">add</a>)</th>
    </tr>
    <!--status 状态对象吧-->
    <tr th:each="emp,status : ${list}">
        <!--id也可能不是连续的 需要连续时 需要status对象-->
        <td th:text="${status.count}"></td>
        <td th:text="${emp.empName}"></td>
        <td th:text="${emp.age}"></td>
        <td th:text="${emp.gender}"></td>
        <td th:text="${emp.email}"></td>
        <td>
            <a href="">更新</a>
            <a href="">删除</a>
        </td>
    </tr>
</table>

<form id="form" method="post">
    <input type="hidden" name="_method" value="delete">
</form>
<script src="/static/js/vue.js"></script>
<script>
    var vm = new Vue({
        el:'#dataTable',
        methods:{
            deleteEmployee:function (e){
                var elementById = document.getElementById("form");
                elementById.action = event.target.href;
                elementById.submit();
                event.preventDefault();
            }
        }
    })
</script>
</body>
</html>